$(function () {
        var token=localStorage.phone;
        var content='';
        var order_id=localStorage.order_id;
        var reasonAll='';
        $('.btn_comfirm').click(function () {
            content=$('.text-input').val();
            $('input[type=checkbox]').each(function () {
                if($(this).prop('checked')){
                    reasonAll+=$(this).val()+',';
                }

            });
            reasonAll=reasonAll+content;
            if(reasonAll!=''){
                $.ajax({
                    url:"https://newapp.icandrive.cn/api/teacher_report.php",
                    dataType:'json',
                    type:'post',
                    data:{token:token,reasonAll:reasonAll,order_id:order_id},
                    success: function (data) {
                        console.log(data);
                        if(data.status==200){
                            localStorage.removeItem("order_id");
                            layer.msg('举报成功');
                            setInterval(function () {
                                window.location.href='../order/oder.html';
                            },2000)
                        }
                        if(data.status==450){
                        	layer.msg('不能重复举报');
                        }
                    },
                    error: function () {

                         layer.msg('系统繁忙',function(){
                                history.go(0)
                            },1000);
                    }

                })
				$(this).unbind();
            }
            else{
                layer.msg('请至少选择一种或输入理由');
            }
        })
    })
